package jpa.entitys.promis.construction;

import java.io.Serializable;
import javax.persistence.*;

/**
 * The primary key class for the COST_BUDGET database table.
 * 
 */
@Embeddable
public class CostBudgetPK implements Serializable {
	//default serial version id, required for serializable classes.
	private static final long serialVersionUID = 1L;

	@Column(unique=true, nullable=false, length=30)
	private String company;

	@Column(unique=true, nullable=false, length=30)
	private String project;

	@Column(name="BUDGET_CODE", unique=true, nullable=false, length=30)
	private String budgetCode;

	@Column(name="REVISION" , unique=true, nullable=false)
	private long revision;
	
    public CostBudgetPK() {
    }
    
    
    
	/**
	 * @return the revision
	 */
	public long getRevision() {
		return revision;
	}



	/**
	 * @param revision the revision to set
	 */
	public void setRevision(long revision) {
		this.revision = revision;
	}



	public String getCompany() {
		return this.company;
	}
	public void setCompany(String company) {
		this.company = company;
	}
	public String getProject() {
		return this.project;
	}
	public void setProject(String project) {
		this.project = project;
	}
	public String getBudgetCode() {
		return this.budgetCode;
	}
	public void setBudgetCode(String budgetCode) {
		this.budgetCode = budgetCode;
	}

	public boolean equals(Object other) {
		if (this == other) {
			return true;
		}
		if (!(other instanceof CostBudgetPK)) {
			return false;
		}
		CostBudgetPK castOther = (CostBudgetPK)other;
		return 
			this.company.equals(castOther.company)
			&& this.project.equals(castOther.project)
			&& this.budgetCode.equals(castOther.budgetCode)
			&& this.revision == castOther.revision;

    }
    
	public int hashCode() {
		final int prime = 31;
		int hash = 17;
		hash = hash * prime + this.company.hashCode();
		hash = hash * prime + this.project.hashCode();
		hash = hash * prime + this.budgetCode.hashCode();
		hash = hash * prime + ((int) (this.revision ^ (this.revision >>> 32)));
		
		return hash;
    }
}